package ru.study.thinkin.chapter6;

import java.util.Random;

class Soup1 {
	private Soup1() {
	}

	public static Soup1 makeSoup() {
		return new Soup1();
	}
}

class Soup2 {
	private static Soup2 ps1 = new Soup2();
	private Long id = new Random().nextLong();
	
	public static Soup2 access() {
		return ps1;
	}
	public void f() {
		
	}
	public Long getId() {
		return id;
	}

}

public class Lunch {
	void testPrivate() {
		//!Soup1 soup = new Soup1(); 
	}
	void testStatic() {
		Soup1 soup = Soup1.makeSoup();
	}
	void testSingleton() {
		//Soup2 s2 = Soup2.access();
		
	}	
	
	public static void main(String[] args) {
 		
		System.out.println("--");
		Soup2 ss2 = Soup2.access();
		Soup2 ss3= Soup2.access();
		Soup2 ss4= new Soup2();
		
		System.out.println(ss2.getId());
		System.out.println(ss3.getId());
		System.out.println(ss4.getId());
			
		
	}

}
